﻿@{
    Layout = null;
}

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="/Scripts/jquery-1.8.2.min.js"></script>
    <link href="/Areas/Admin/style/css/login.css" rel="stylesheet" />
    <title>
       超市管理系统
    </title>
    <script>
        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) { // enter 键
                login();
            }
        };
        $(function() {
            var t = "@ViewData["t"]";
            if (t == "1") {
                window.parent.location.href = "@Url.Action("Index",new {id=""})";
            }
        });
        function reloadcode() {
            document.getElementById("Img1").src = "@Url.Action("ValideteImg")?"  + new Date;
        }
        $(function () {
            reloadcode();
        });

        function login() {
            var username = $("#username").val();
            if (username == "") {
                alert("请输入用户名！");
                return false;
            }
            var pwd = $("#pwd").val();
            if (pwd == "") {
                alert("请输入密码！");
                return false;
            }
            var yzm = $("#yzm").val();
            if (yzm == "") {
                alert("请输入验证码！");
                reloadcode();
                return false;
            }
            $.post("@Url.Action("UserLogin")", { username: username, pwd: pwd, yzm: yzm }, function (row) {
                if (row == "errorcode") {
                    alert("验证码输入错误！");
                    reloadcode();
                }
                else if(row == "1") {
                    location.href = "/admin/manage/index";
                } else if (row == "0") {
                    alert("登陆失败！");
                    reloadcode();
                }else if (row == "-1") {
                    alert("您的账号已被禁用，请联系管理员！");
                }
                else if (row == "-2") {
                    alert("您不具有管理员权限！");
                }
            });
        }
    </script>
</head>

<body>
   <div class="title_s">
        <div style="font-size: 32px;">理工.超市管理系统</div>
        <div style="font-size: 15.5px;">Chain store management system</div>
    </div>


    <div class="textl1">
        <div id="textl" style="opacity: 0.8; border: 1px #666 solid;">
           
            <div style="width:300px; height:30px;">
                <label>用户名：</label>
                <input type="text" id="username" value="admin" name="username" />
            </div>
            <div style="width:300px; height:30px;">
                <label>密&nbsp;码：</label>
                <input type="password" id="pwd" name="pwd" value="123465" />
            </div>
            <div style="width:300px; height:30px;">
                <label>验证码：</label>
                <input type="text" id="yzm" name="yzm" style="width:70px;" />
                <img id="Img1" src="@Url.Action("ValideteImg")" onclick="reloadcode()" style="height: 30px;float: left;" />
            </div>
            <div style="width:300px; height:30px; margin-top:40px; text-align: center;">
                <div style="width: 40px;height: 30px;float: left;"></div>
                <a id="login" onclick="login()">登录</a>
                <div style="width: 60px;height: 30px;float: left;"></div>
                <a id="login" onclick="location.reload()">重置</a>
            </div>
        </div>
    </div>


    <div id="bg">
        @*<img src="/Areas/Admin/style/images/loginbg.jpg" />*@
    </div>
    <div style="color: #fff;width: 100%;height:50px; position: absolute; bottom: 0px; text-align: center;font-size: 12px;line-height: 20px;">
        CopyRight©理工超市店<br/>
    </div>
</body>
</html>
